﻿namespace Sidvall.Office
{
    public class WorkbookFont : Sidvall.Office.IWorkbookFont
    {
        #region Public Members

        #region Bold

        public bool? Bold
        {
            get
            {
                switch (this.InternalWorkbookFont.Bold)
                {
                    case Infragistics.Documents.Excel.ExcelDefaultableBoolean.False:
                        return false;
                    case Infragistics.Documents.Excel.ExcelDefaultableBoolean.True:
                        return true;
                    default:
                        return null;
                }
            }
            set
            {
                if (value == true)
                    this.InternalWorkbookFont.Bold = Infragistics.Documents.Excel.ExcelDefaultableBoolean.True;
                else if (value == false)
                    this.InternalWorkbookFont.Bold = Infragistics.Documents.Excel.ExcelDefaultableBoolean.False;
                else
                    this.InternalWorkbookFont.Bold = Infragistics.Documents.Excel.ExcelDefaultableBoolean.Default;
            }
        }

        #endregion
        #region Italic

        public bool? Italic
        {
            get
            {
                switch (this.InternalWorkbookFont.Italic)
                {
                    case Infragistics.Documents.Excel.ExcelDefaultableBoolean.False:
                        return false;
                    case Infragistics.Documents.Excel.ExcelDefaultableBoolean.True:
                        return true;
                    default:
                        return null;
                }
            }
            set
            {
                if (value == true)
                    this.InternalWorkbookFont.Italic = Infragistics.Documents.Excel.ExcelDefaultableBoolean.True;
                else if (value == false)
                    this.InternalWorkbookFont.Italic = Infragistics.Documents.Excel.ExcelDefaultableBoolean.False;
                else
                    this.InternalWorkbookFont.Italic = Infragistics.Documents.Excel.ExcelDefaultableBoolean.Default;
            }
        }

        #endregion
        #region Height

        public int Height
        {
            get
            {
                return this.InternalWorkbookFont.Height;
            }
            set
            {
                this.InternalWorkbookFont.Height = value;
            }
        }

        #endregion
        #region Name

        public string Name
        {
            get
            {
                return this.InternalWorkbookFont.Name;
            }
            set
            {
                this.InternalWorkbookFont.Name = value;
            }
        }

        #endregion
        #region ColorInfo

        public object ColorInfo
        {
            get
            {
                return this.InternalWorkbookFont.ColorInfo;
            }
            set
            {
                this.InternalWorkbookFont.ColorInfo = value as Infragistics.Documents.Excel.WorkbookColorInfo;
            }
        }

        #endregion

        #region ToString

        public override string ToString()
        {
            return "WorkbookFont - Sidvall.Office.IG";
        }

        #endregion

        #endregion
        #region Private Members

        internal Infragistics.Documents.Excel.IWorkbookFont InternalWorkbookFont { get; set; }

        #endregion
        #region Constructors

        public WorkbookFont(Infragistics.Documents.Excel.IWorkbookFont workbookFont)
        {
            this.InternalWorkbookFont = workbookFont;
        }

        #endregion
    }
}
